﻿using Engine;
using Game.Server.Event;

namespace Game.Server.Plugins
{
    public class MatchRecordPlugin : ServerPlugin, IFireEventHandle
    {
        public override int Version => 10000;

        public override string Name => "火柴记录";

        public byte FirstLevel => 0;

        public override void Initialize()
        {
            FireEventManager.AddObject(this);
        }

        public bool Fire(Ray3 ray, ComponentMiner componentMiner)
        {
            ComponentPlayer player = componentMiner.ComponentPlayer;
            Log.Information($"[社区ID{player.PlayerData.Client.CommunityAccountId}]{player.PlayerData.Name}  在{ray.Position.X},{ray.Position.Y},{ray.Position.Z} 向 {ray.Direction.X},{ray.Direction.Y},{ray.Direction.Z} 方向使用了火柴");
            return true;
        }

        public bool FireTerrain(CellFace cellFace, ComponentMiner componentMiner)
        {
            ComponentPlayer player = componentMiner.ComponentPlayer;
            Log.Information($"[社区ID{player.PlayerData.Client.CommunityAccountId}]{player.PlayerData.Name} 向 {cellFace.X},{cellFace.Y},{cellFace.Z}所在的方块使用了火柴");
            return true;
        }

        public override void Load()
        {
        }

        public override void Save()
        {
        }
    }
}